//
//  TeacherOrderTimeCell.m
//  SDSY
//
//  Created by 蓝布鲁 on 2017/4/10.
//  Copyright (c) 2017 蓝布鲁. All rights reserved.
//

#import "TeacherOrderTimeCell.h"
#import "OrderTeacherButton.h"

@implementation TeacherOrderTimeCell

- (void)setModel:(TeacherOrderTimeModel *)model {
    _model = model;
    // 设置text
    self.textLabel.font = [UIFont systemFontOfSize:15];
    
    NSString *startTime = [model.starttime formatDateWithInputFormat:@"HH:mm:ss" outputFormat:@"HH:mm"];
    NSString *endTime = [model.endtime formatDateWithInputFormat:@"HH:mm:ss" outputFormat:@"HH:mm"];
    if(self.needShowDate){
        // 需要显示年月
        self.textLabel.text = [NSString stringWithFormat:@"%@ %@ ~ %@", [model.date formatDate], startTime, endTime];
    } else {
        // 不需要显示年月
        self.textLabel.text = [NSString stringWithFormat:@"%@ ~ %@",startTime,endTime];
    }


    // 设置预约按钮
    OrderTeacherButton *button = [[OrderTeacherButton alloc] initWithFrame:CGRectMake(0, 0, 20, 25)];
    button.code = model.code;
    [button sizeToFit];
    self.accessoryView = button;
    
    if (button.enabled == false) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
}



@end
